<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<form action="js_01_三种使用方式.html" method="get" onsubmit="return f1()" >
			
			
			邮编;<input type="" name="" id="i1" value="" />
			邮箱:<input type="" name="" id="i2" value="" />
			
			<input type="submit" value=""/>
		</form>
		<script>
			function f1(){
				var a=document.getElementById("i1").value;
				if(a.length!=6){
					alert("邮编应该是六位");
					return false;
				}
				else{
					flag=true;
					for(i=0;i<a.length;i++){
						b=a.charAt(i);
						if(b<'0'||b>'9'){
							alert("邮编非法");
							flag= false;
							break;
						}
					}
					if(!flag){
						alert("邮编非法");
						return false;
					}
					else{
						alert("hege");
					}
				}
				
				var b=document.getElementById("i2").value;
				var c=b.indexOf("@");
				var d=b.indexOf(".");
				if(c>-1&&d>-1&&c<d){
					alert("hege");
					
				}
				else{
					alert("buhege");
					return false;
				}
				return true;
			}
			
			
			
			
			
			
		</script>
		
		
		
		
		
		
		
		
		
		
	</body>
</html>
